package com.oa.biz.impl;

import java.util.List;
import java.util.Map;

import com.mysql.jdbc.JDBC4PreparedStatement;
import com.oa.bean.DepartInfo;
import com.oa.bean.PreContract;
import com.oa.bean.Schedules;
import com.oa.bean.UserInfo;
import com.oa.biz.SuperService;
import com.oa.dao.SuperDao;
import com.oa.dao.impl.CommonDao;
import com.oa.util.PageUtil;

public class CommonService<T> implements SuperService<T> {

	SuperDao<T> sDao=new CommonDao<T>();

	@Override
	public List<T> findAll(T t, PageUtil<T> pu) {
		return sDao.find(t, pu);
	}

	@Override
	public List<T> query(Map<String, Object> param, T t) {
		return sDao.query(param, t);
	}

	@Override
	public List<T> search(Map<String, Object> param, T t) {
		return sDao.query(param, t);
	}

	@Override
	public UserInfo login(UserInfo user) {
		return sDao.findOne(user);
	}

	@Override
	public T findById(T t, String... id) {
		return sDao.findById(t, id);
	}

	@Override
	public boolean add(T t) {
		return sDao.add(t)>0;
	}

	@Override
	public boolean modify(T t) {
		return sDao.update(t)>0;
	}

	@Override
	public boolean remove(T t) {
		return sDao.delete(t)>0;
	}

	@Override
	public int getCount(T t) {
		return sDao.getTotalCount(t);
	}

	@Override
	public T findOne(Map<String, Object> param, T t) {
		return sDao.findOne(param, t);
	}

	@Override
	public int getCountByContidion(Map<String, Object> param, T t) {
		return sDao.getCountCondition(param, t);
	}

	@Override
	public boolean addSchedule(Schedules sInfo, PreContract pInfo, String beginTime, String endTime,
			String createTime) {
		return sDao.addSchedule(sInfo, pInfo,beginTime,endTime,createTime);
	}

	@Override
	public List<DepartInfo> getGivenDeparts(String branchId) {
		return sDao.findGivenDeparts(branchId);
	}

	@Override
	public List<Schedules> searchSchedules(String deptId, String userName, String sDate) {
		return sDao.querySchedules(deptId,userName,sDate);
	}


	


}
